package com.neuedu.user.controller;

import com.neuedu.user.entity.User;
import com.neuedu.user.service.UserService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

@RestController
@RequestMapping("/loginController")
public class LoginController {

    @Autowired
    private UserService service;

    @ResponseBody
    @RequestMapping("/login")
    //  http://localhost:8090/loginController/login?tle=17586522048&pwd=123
    public User login(User u) {
    	System.out.println(u);
        return service.login(u);
    }

    @RequestMapping("/logout")
    //  http://localhost:8088/loginController/logout
    public String logout(HttpSession se) {
        se.invalidate();
        return "ok";
    }
}